package com.ruoyi.mapper;

import com.ruoyi.common.core.domain.entity.SysDictData;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DictDataMapper {

    @Select("select * from sys_dict_data where dict_type = #{type}")
    List<SysDictData> selectDict(@Param("type") String type);

    @Insert("INSERT INTO sys_dict_data " +
            "( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) " +
            "VALUES " +
            "( #{dictSort}, #{dictLabel}, #{dictValue}, #{dictType}, #{cssClass}, #{listClass}, #{isDefault}, #{status}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark})")
    int insertSysDictData(SysDictData sysDictData);

    @Select("select dict_type from sys_dict_data where dict_label = #{publish}")
    int publishValue (String publish);

    @Select("select dict_type from sys_dict_data where dict_label = #{language}")
    int languageValue (String language);
}
